<?php

use yii\db\Migration;

class m210915_111731_minerva_notallow_header extends Migration
{
    public function up()
    {
        /* 取消外键约束 */
        $this->execute('SET foreign_key_checks = 0');
        
        /* 创建表 */
        $this->createTable('{{%minerva_notallow_header}}', [
            'id' => "int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id'",
            'auth' => "int(11) NULL COMMENT '角色主键id'",
            'header' => "varchar(255) NULL COMMENT '文件头名称'",
            'PRIMARY KEY (`id`)'
        ], "ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='大数据系统-拒绝文件头表'");
        
        /* 索引设置 */
        
        
        /* 表数据 */
        $this->insert('{{%minerva_notallow_header}}',['id'=>'1','auth'=>'1','header'=>'000']);
        $this->insert('{{%minerva_notallow_header}}',['id'=>'2','auth'=>'1','header'=>'111']);
        
        /* 设置外键约束 */
        $this->execute('SET foreign_key_checks = 1;');
    }

    public function down()
    {
        $this->execute('SET foreign_key_checks = 0');
        /* 删除表 */
        $this->dropTable('{{%minerva_notallow_header}}');
        $this->execute('SET foreign_key_checks = 1;');
    }
}

